Quantization method and device for weights of batch normalization layer

ABSTRACT

An embodiment of the present invention provides a quantization method for weights of a plurality of batch normalization layers, including: receiving a plurality of previously learned first weights of the plurality of batch normalization layers; obtaining first distribution information of the plurality of first weights; performing a first quantization on the plurality of first weights using the first distribution information to obtain a plurality of second weights; obtaining second distribution information of the plurality of second weights; and performing a second quantization on the plurality of second weights using the second distribution information to obtain a plurality of final weights, and thereby reducing an error that may occur when quantizing the weight of the batch normalization layer.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims priority to and the benefit of Korean Patent Application No. 10-2018-0138455 filed in the Korean Intellectual Property Office on Nov. 12, 2018, the entire contents of which are incorporated herein by reference.

BACKGROUND OF THE INVENTION (a) Field of the Invention

The present invention relates to a quantization method and device for weights of a batch normalization layer.

(b) Description of the Related Art

A batch normalization layer is a neural network layer that normalizes the mean of input data to 0 and the variance thereof to 1. The batch normalization layer is designed to increase learning speed without causing problems such as gradient vanishing of input data or gradient exploding of input data when learning a neural network using input data, and to this end, the batch normalization layer may normalize the input data and then scale and shift the normalized data.

When a neural network including the batch normalization layer is implemented in hardware, it is necessary to quantize a weight of an initially specified batch normalization layer in order to reduce a bit-width requirement amount of an operator and to reduce a memory capacity required to store the weight of the batch normalization layer.

A method of quantizing the weight of the batch normalization layer includes a dynamic range floating point quantization method and an integer power-of-two quantization method. However, neither method performs well for the weight quantization of the batch normalization layer.

For example, the dynamic range floating point quantization method has a disadvantage in that it may not sufficiently accommodate a wide range of values of weights of the batch normalization layer. Meanwhile, the integer power-of-two quantization method can accommodate a wide range of values, but has a disadvantage in that the interval between the quantization values is very wide.

The above information disclosed in this Background section is only for enhancement of understanding of the background of the invention, and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art.

SUMMARY OF THE INVENTION

The present invention has been made in an effort to provide a method and device that may accommodate the wide range weights of the batch normalization layer while allowing the interval of the quantization result values to be densely formed.

An embodiment of the present invention provides a quantization method for weights of a plurality of batch normalization layers, including: receiving a plurality of previously learned first weights of the plurality of batch normalization layers; obtaining first distribution information of the plurality of first weights; performing a first quantization on the plurality of first weights using the first distribution information to obtain a plurality of second weights; obtaining second distribution information of the plurality of second weights; and performing a second quantization on the plurality of second weights using the second distribution information to obtain a plurality of final weights.

The quantization method may further include assigning a first bit width, which is a part of all bit widths assigned to the quantization, to the first quantization.

The quantization method may further include assigning a second bit width, which is a part of all bit widths assigned to the quantization, to the second quantization.

The first bit width and the second bit width may be the same bit width.

The first bit width and the second bit width may be 4 bits.

The first distribution information may include an average value and a variance value of the plurality of first weights, and the second distribution information may include an average value and a variance value of the plurality of second weights.

The first quantization may be an integer power-of-two quantization, and the second quantization may be a dynamic range floating point quantization.

The quantization method may further include repeating the receiving, the obtaining of the distribution information, and the quantizing, for the plurality of first weights a predetermined number of times.

The quantization method may further include repeatedly applying a quantization process for the first layer of the remaining layers among the plurality of batch normalization layers.

Another embodiment of the present invention provides a batch normalization layer quantization device, including: an input part that receives a plurality of previously learned first weights and input data of a plurality of batch normalization layers; a processor that obtains first distribution information of the plurality of first weights, performs a first quantization on the plurality of first weights using the first distribution information to obtain a plurality of second weights, obtains second distribution information of the second plurality of weights, performs a second quantization on the plurality of second weights using the second distribution information to obtain a plurality of final weights, and performs normalization on the input data using the plurality of final weights; and a memory that stores the plurality of final weights.

The processor may assign a first bit width, which is a part of all bit widths assigned to the quantization, to the first quantization.

The processor may assign a second bit width, which is a part of all bit widths assigned to the quantization, to the second quantization.

The first bit width and the second bit width may be the same.

The first bit width and the second bit width may be 4 bits.

The first quantization may be an integer power-of-two quantization, and the second quantization may be a dynamic range floating point quantization.

The first distribution information may include an average value and a variance value of the plurality of first weights, and the second distribution information may include an average value and a variance value of the plurality of second weights.

The processor may repeat the receiving, the obtaining of the distribution information, and the quantizing, for the plurality of first weights a predetermined number of times.

Another embodiment of the present invention provides a quantization method for weights of a plurality of batch normalization layers, including: receiving a plurality of previously learned first weights of the plurality of batch normalization layers; obtaining first distribution information of the plurality of first weights; performing a first quantization on the plurality of first weights using the first distribution information to obtain a plurality of second weights; obtaining second distribution information of the plurality of second weights; performing a second quantization on the plurality of second weights using the second distribution information to obtain a plurality of final weights; and performing normalization on the input data using the plurality of final weights.

The first distribution information may include an average value and a variance value of the plurality of first weights, and the second distribution information may include an average value and a variance value of the plurality of second weights.

The quantization method may further include repeatedly applying a quantization process for the first layer of the remaining layers among the plurality of batch normalization layers.

According to the embodiment of the present invention, it is possible to effectively cover a wide distribution of weight values of a batch normalization layer and narrow a quantization interval, thereby reducing errors that may occur when quantizing the weight of the batch normalization layer.

According to the embodiment of the present invention, when a neural network including a batch normalization layer is implemented in hardware, deterioration in performance that may occur when quantizing the batch normalization layer may be minimized, and since a bit width required amount of an operator is reduced, power for operation may be reduced, and memory capacity required for storing the weight of the batch normalization layer may be reduced.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a block diagram of a quantization device according to an embodiment of the present invention.

FIG. 2 illustrates a flowchart of a quantization method according to an embodiment of the present invention.

FIG. 3 illustrates a weight that is a quantized result according to an embodiment of the present invention.

FIG. 4 illustrates a batch normalization layer according to an embodiment of the present invention.

DETAILED DESCRIPTION OF THE EMBODIMENTS

Hereinafter, the present invention will be described more fully with reference to the accompanying drawings, in which exemplary embodiments of the invention are shown. As those skilled in the art would realize, the described embodiments may be modified in various different ways, all without departing from the spirit or scope of the present invention. Accordingly, the drawings and description are to be regarded as illustrative in nature and not restrictive. Like reference numerals designate like elements throughout the specification.

FIG. 1 illustrates a block diagram of a quantization device according to an embodiment of the present invention.

As shown in FIG. 1, a batch normalization layer quantization device 100 may include a memory 110, an input part 120, and a processor 130.

The memory 110 may store input data to be normalized by the batch normalization layer. The memory 110 may store previously-learned weights and quantized weights.

The input part 120 may receive input data from the outside and transmit the input data to the processor 130. The input part 120 may receive the previously-learned weight from the memory 110 or from the outside and transmit it to the processor 130.

The processor 130 may perform steps S201 to S211 shown in FIG. 2 to quantize weights, which will be described later in detail.

FIG. 2 illustrates a flowchart of a quantization method according to an embodiment of the present invention.

As shown in FIG. 2, first, the processor 130 may obtain a previously-learned weight of the batch normalization layer from the input part 120 (S201).

For example, the weight may be a synapse weight of a synapse that connects neurons in the neural network.

For example, the processor 130 may normalize all input data, and alternatively, it may normalize a mini-batch of sample input data that are a part of all the input data. The mini-batch may mean a predetermined number of sample input data among the entire input data of the batch normalization layer. A size of the mini-batch (the number of sample input data) may be preset by a manufacturer or a user, but is not limited thereto. A set B of the sample input data included in the mini-batch may be defined as B={x₁, x₂, . . . , X_(m)}.

The processor 130 normalizes at least some of the input data of the mini-batch or all the input data, and it may scale and shift and bias the normalized input data to a conversion data y_(i).

The processor 130 may obtain the conversion data y_(i) by the following Equation 1.

y _(i) =BN _(γ,β)(x _(i))  (Equation 1)

Here, BN is a batch normalization function, γ is a scale coefficient, and β is a shift coefficient.

As shown in Equation 1 above, the processor 130 may obtain the conversion data y_(i) by applying the batch normalization function to all input data x_(i).

In order to obtain the batch normalization function for obtaining the conversion data y_(i), the processor 130 may calculate the mini-batch mean μB by Equation 2 below.

$\begin{matrix} \left. {\mu \; B}\leftarrow{\frac{1}{m}{\sum\limits_{i = 1}^{m}x_{i}}} \right. & \left( {{Equation}\mspace{14mu} 2} \right) \end{matrix}$

Here, m may be a size of the mini-batch (the number of sample input data).

As shown in Equation 2, the processor 130 may calculate the mini-batch mean μB of the sample input data of the mini-batch by obtaining a sum of respective sample input data of the mini-batch among the input data, and dividing the sum of the respective sample input data of the mini-batch by the size m of the mini-batch.

The processor 130 may calculate a variance σ² (σ is a standard deviation) using the following Equation 3.

$\begin{matrix} \left. \sigma_{B}^{2}\leftarrow{\frac{1}{m}{\sum\limits_{i = 1}^{m}\left( {x_{i} - \mu_{B}} \right)^{2}}} \right. & \left( {{Equation}\mspace{14mu} 3} \right) \end{matrix}$

As shown in Equation 3 above, the processor 130 may calculate the variance σ² by calculating respective squares of respective values obtained by subtracting the mini-batch mean μB value from respective sample input data of the mini-batch for all the sample input data included in the mini-batch, and then adding them, and by dividing the added value by the size m of the mini-batch.

The processor 130 may normalize the input data x_(i) using Equation 4 below.

$\begin{matrix} \left. {\hat{x}}_{i}\leftarrow\frac{x_{i} - \mu_{B}}{\sqrt{\sigma_{B}^{2} + \epsilon}} \right. & \left( {{Equation}\mspace{14mu} 4} \right) \end{matrix}$

Here, ε is a constant, and may be previously set.

As shown in Equation 4 above, the processor 130 may normalize the input data x_(i) by dividing a value obtained by subtracting the average μB of the mini-batch calculated above from each input data x_(i) by a sum of the variance σ2 of the mini-batch and the constant value ε.

After normalizing the input data x_(i), the processor 130 may convert the normalized input data x_(i) to the conversion data y_(i), and the conversion data y_(i) may be represented by the following Equation 5.

$\begin{matrix} {\left. y_{i}\leftarrow{{\gamma \; {\hat{x}}_{i}} + \beta} \right. = {{{\gamma\left( \frac{x_{l} - \mu_{B}}{\sqrt{\sigma_{B}^{2} + \epsilon}} \right)} + \beta} = {{\frac{\gamma}{\sqrt{\sigma_{B}^{2} + \epsilon}}x_{l}} + \left( {{- \frac{\gamma \cdot \mu_{B}}{\sqrt{\sigma_{B}^{2} + \epsilon}}} + \beta} \right)}}} & \left( {{Equation}\mspace{14mu} 5} \right) \end{matrix}$

Here,

$\frac{\gamma}{\sqrt{\sigma_{B}^{2} + \epsilon}}$

is a scale weight, which may be simplified to W₀, and

$\left( {{- \frac{\gamma \cdot \mu_{B}}{\sqrt{\sigma_{B}^{2} + \epsilon}}} + \beta} \right)$

is a shift weight, which may be simplified to W₁.

As shown in Equation 5 above, the conversion data y_(i) may be represented by adding the shift weight to the product of x_(i) and the scale weight.

Referring again to FIG. 1, after step S201, the processor 130 may set previously-learned values (for example, W₀=1, W₁=0) to the weights W₀ and W_(One), and may perform a first synapse distribution analysis with respect to the previously-set weights W0 and W1 of the batch normalization layer (S203).

As described above, the processor 130 may initially previously set 1 to the scale weight W₀ and may previously set 0 to the shift weight W₁, but the present invention is not limited thereto.

For example, the processor 130 may obtain first distribution information through a first synapse distribution analysis (max (abs (W))) on the previously-learned first weights W0 and W1, and the first distribution information may include information about an average value and a variance value of the first weights W0 and W1 and a size of the first weights W0 and W1.

After step S203, the processor 130 may apply an integer power-of-two quantization to the previously-learned first weights W0 and W1 using the first distribution information calculated in step S203 to obtain the integer power-of-two quantized second weight (S205).

The processor 130 may perform the integer power-of-two quantization on the first weights through the following Equations 6 to 10 to obtain the second weights (WIQ_(L))(WIQ₀ and WIQ₁).

First, the processor 130 may obtain the integer n1 using Equation 6 and Equation 7.

$\begin{matrix} {{s = {\max \left( {{abs}\left( W_{l} \right)} \right)}},} & \left( {{Equation}\mspace{14mu} 6} \right) \\ {n_{1} = {{floor}\left( {\log_{2}\left( \frac{4s}{3} \right)} \right)}} & \left( {{Equation}\mspace{14mu} 7} \right) \end{matrix}$

Here, n1 is an integer of 0 or more, W_(L) may mean W₀ or W₁, and floor(x) means the largest integer not greater than x.

As shown in Equation 6 and Equation 7, the processor 130 may calculate a maximum value s of a size of WL(W0, W1), calculate a log value of 2 of 4/3*s using the s, and apply the calculated log value to the floor function to obtain n1.

The processor 130 may then obtain the integer n2 using Equation 8 below.

$\begin{matrix} {n_{2} = {n_{1} + 1 - {\frac{2^{({b - 1})}}{2}.}}} & \left( {{Equation}\mspace{14mu} 8} \right) \end{matrix}$

Here, n2 is an integer of 0 or more, which is smaller than or equal to n1, and b may mean a bit width that is previously assigned to the integer power-of-two quantization.

As shown in Equation 8, the processor 130 may calculate n2 by adding a value obtained by dividing a constant 1 and a power of n−1 of 2 by 2 to the integer n1, which is calculated by Equation 7.

The processor 130 may then calculate an integer set P_(L) using the following Equation 9.

P _(l)={±2^(n) ¹ , . . . ,±2^(n) ² ,0}  (Equation 9)

As shown in Equation 9, the processor 130 may determine a set P_(L) consisting of terms of 2 powers from n1 calculated by Equation 7 to n2 calculated by Equation 8.

Then, the processor 130 may calculate the second weight WIQ_(L)(i, j)(WIQ₀(i, j), WIQ₁(i, j)) whose index is (i, j), in a corresponding layer by using Equation 10.

$\begin{matrix} {{\left( {i,j} \right)} = \left\{ {\begin{matrix} {\beta \; {{sgn}\left( {W_{l}\left( {i,j} \right)} \right)}} & {{{if}\mspace{14mu} {\left( {\alpha + \beta} \right)/2}} \leq {{abs}\left( {W_{l}\left( {i,j} \right)} \right)} < {3{\beta/2}}} \\ 0 & {otherwise} \end{matrix},} \right.} & \left( {{Equation}\mspace{14mu} 10} \right) \end{matrix}$

Here, sgn(x) is a function that outputs −1 when x is negative, 0 when x is 0, and 1 when x is positive. In addition, α and β may mean terms adjacent to each other in the P_(L) set.

As shown in Equation 10, the processor 130 may determine WIQ_(L)(i, j) as a value obtained by multiplying P by an output value obtained by inputting W_(L)(i, j) into the sgn function in a corresponding layer when a value of W_(L)(i, j) whose index is (i, j) is greater than or equal to a value obtained by dividing a sum of α and β by 2 and smaller than a value obtained by dividing 3*β by 2. Alternatively, the processor 130 may determine WIQ_(L)(i, j) as 0 when W_(L)(i, j) is smaller than the sum of α and β divided by 2, or greater than or equal to 3*β divided by 2.

After step S205, the processor 130 may perform a second synapse distribution analysis with respect to the second weights WIQ_(L)(i, j)(WIQ₀(i, j), WIQ₁(i, j)) to which an integer power-of-two quantization is applied (S207).

For example, the processor 130 may obtain second distribution information through the second synapse distribution analysis (max(abs(W-WIQ_(L)))) on the second weights WIQ_(L)(i, j)(WIQ₀(i, j), WIQ₁(i, j)), and the second distribution information may include information with respect to an average value, a variance value, and a size of the second weights of the second weights WIQ_(L)(i, j)(WIQ₀(i, j), WIQ₁(i, j)).

After step S207, the processor 130 may perform dynamic range floating point quantization on the second weights WIQ_(L)(i, j)(WIQ₀(i, j), WIQ₁(i, j)) of the batch normalization layer using the second distribution information, thereby calculating final weights WDQ_(L)(i, j)(WDQ₀(i, j), WDQ₁(i, j)) (S209).

The processor 130 may perform the dynamic range floating point quantization on the second weights through the following Equation 11 to Equation 14 to obtain the final weights.

First, the processor 130 may calculate an integer length I_(L) using the following Equation 11.

Il=ceil(log 2(max(abs(WIQ _(l)(i,j))))+1)  (Equation 11)

Here, the function ceil(x) is a function that rounds off any decimal point value of x.

As shown in Equation 11, the processor 130 may calculate a log value of 2 of the maximum value of WIQ_(L)(i, j), and add 1 to the log value to obtain a result value input to the ceil function as I_(L).

The processor 130 may then calculate a fractional length I_(L) using the following Equation 12.

fl(fractional length)=b−il  (Equation 12)

Here, b may mean a bit width assigned to the dynamic range floating point quantization.

As shown in Equation 12 above, the processor 130 may obtain a value, which is f_(L), obtained by subtracting I_(L) calculated by Equation 11 from b.

The processor 130 may then calculate an integer set P_(L) using the following Equation 13.

P _(l)={±(2^((−fl)))(0,1, . . . ,(2^((b−1))−1))}  (Equation 13)

As shown in Equation 13 above, the processor 130 determines a set P_(L) consisting of a product of powers of 2 including 0 and powers from a power of 2 with an exponent of 0 to a power of 2 with an exponent b−1 multiplied by (−f_(L)) power of 2.

The processor 130 may then use the following Equation (14) to calculate a final weight WDQ_(L)(i, j) whose index is (i, j) in a corresponding layer.

$\begin{matrix} {{\left( {i,j} \right)} = \left\{ {\begin{matrix} {\max_{d}{*{{sgn}\left( {W_{l}\left( {i,j} \right)} \right)}}} & {{{if}\mspace{14mu} {{abs}\left( {W_{l}\left( {i,j} \right)} \right)}} \geq {max\_ d}} \\ {\beta \; {{sgn}\left( {W_{l}\left( {i,j} \right)} \right)}} & \begin{matrix} {{\beta - \left( 2^{({{- {fl}} - 1})} \right)} \leq} \\ {{{abs}\left( {W_{l}\left( {i,j} \right)} \right)} < {\beta + \left( 2^{({{- {fl}} - 1})} \right)}} \end{matrix} \end{matrix},} \right.} & \left( {{Equation}\mspace{14mu} 14} \right) \end{matrix}$

Here, max_d is a maximum element in the set P_(L), and it may be represented as max_d=(2^((b−1))−1)*(2^((−fL))). In addition, β is a positive element in the set P_(L).

As shown in Equation 14, when a value of WIQ_(L)(i, j) is greater than or equal to the max_d, the processor 130 may calculate a final weight WDQ_(L)(i, j) by multiplying an output value obtained by inputting a value of WIQ_(L)(i, j) into the sgn function by max_d. Alternatively, when the value of WIQ_(L)(i, j) is greater than or equal to β−2^((−fL−1)) and smaller than β+2^((−fL−1)), the processor 130 may calculate the final weight WDQ_(L)(i, j) by multiplying the output value obtained by inputting the WIQ_(L)(i, j) into the sgn function by β.

The processor 130 may then perform a predetermined number of retraining operations for the final weights (S211).

That is, the processor 130 may re-execute learning a preset number of times (for example, a number required by a user, a learning rate) for the final weight of the batch normalization layer.

The processor 130 may perform step S201 to step S211 for the weights of all the batch normalization layers in the neural network.

For example, the processor 130 may execute the above-described steps S201 to S211 and may re-perform learning as many times as required by using different IQs (bitwidth_IQ) and different DQs (bitwidth_DQ) for different weights of different batch normalization layers in the neural network.

FIG. 3 illustrates a weight that is a quantized result according to an embodiment of the present invention.

As shown in FIG. 3, the bit width (bitwidth_IQ) of the IQ may be the bit width assigned to the integer power-of-two quantization. The processor 130 may set some bit widths of all the quantization bit widths of an operator (not shown) included in the batch normalization layer quantization device to be assigned to the integer power-of-two quantization. For example, the processor 130 may assign 4 bits out of all the 8 bits of the operator to the bit width for the integer power-of-two quantization, but the present invention is not limited thereto.

As shown in FIG. 3, the bit width (bitwidth_DQ) of the DQ may be the bit width assigned to the dynamic range floating point quantization. The processor 130 may set the DQ bit width (bitwidth_DQ) of all the quantization bit widths to the bit width assigned to the dynamic range floating point quantization. For example, the processor 130 may set 4 bits of all the quantization bit widths of 8 bits to the DQ bit width, but the present invention is not limited thereto.

FIG. 4 illustrates a batch normalization layer according to an embodiment of the present invention.

As shown in FIG. 4, for example, the batch normalization layer is configured using the method applied to the GoogLeNet_v2 neural network and may be configured based on the batch normalization layer configuration of CAFFE, which is an open source neural network learning framework, but the present invention is not limited thereto.

For example, the batch normalization layer may be divided into a batch normalization layer and a scale layer, but is not limited thereto.

The batch normalization layer may estimate (feed forward) the output data from the input data using the final weights obtained in FIG. 1 to FIG. 3.

The CAFFE framework defines a neural network interference operation, which may mean a process of obtaining the final weight.

The CAFFE framework may define the input (x) of the neural network interference operation as a bottom and the output (y) of the neural network interference operation as a top, but is not limited thereto.

For example, a batch size of the bottom of the batch normalization layer may be 1×64×112×112. That is, the batch size of the bottom of the batch normalization layer may be set to 1, a channel size (ch) to 64, an input image vertical size (h) to 112, and an input image horizontal size (w) to 112.

The processor 130 may calculate the output (top, scale weight, shift weight) using the input (bottom, previously-learned mean (input channel size=64), variance (input channel size=64)). For example, the processor 130 may perform the batch normalization and obtain the top components (ch, h, w) using the mean and variance of the channels in which the input data are included for all components of the input data.

While this invention has been described in connection with what is presently considered to be practical exemplary embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, but, on the contrary, is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims. 

What is claimed is:
 1. A quantization method for weights of a plurality of batch normalization layers, comprising: receiving a plurality of previously learned first weights of the plurality of batch normalization layers; obtaining first distribution information of the plurality of first weights; performing a first quantization on the plurality of first weights using the first distribution information to obtain a plurality of second weights; obtaining second distribution information of the plurality of second weights; and performing a second quantization on the plurality of second weights using the second distribution information to obtain a plurality of final weights.
 2. The quantization method of claim 1, further comprising assigning a first bit width, which is a part of all bit widths assigned to the quantization, to the first quantization.
 3. The quantization method of claim 2, further comprising assigning a second bit width, which is a part of all bit widths assigned to the quantization, to the second quantization.
 4. The quantization method of claim 3, wherein the first bit width and the second bit width are the same bit width.
 5. The quantization method of claim 4, wherein the first bit width and the second bit width are 4 bits.
 6. The quantization method of claim 1, wherein the first distribution information includes an average value and a variance value of the plurality of first weights, and the second distribution information includes an average value and a variance value of the plurality of second weights.
 7. The quantization method of claim 1, wherein the first quantization is an integer power-of-two quantization, and the second quantization is a dynamic range floating point quantization.
 8. The quantization method of claim 1, further comprising repeating the receiving, the obtaining of the distribution information, and the quantizing, for the plurality of first weights a predetermined number of times.
 9. The quantization method of claim 1, further comprising repeatedly applying a quantization process for the first layer of the remaining layers among the plurality of batch normalization layers.
 10. A batch normalization layer quantization device, comprising: an input part that receives a plurality of previously learned first weights and input data of a plurality of batch normalization layers; a processor that obtains first distribution information of the plurality of first weights, performs a first quantization on the plurality of first weights using the first distribution information to obtain a plurality of second weights, obtains second distribution information of the second plurality of weights, performs a second quantization on the plurality of second weights using the second distribution information to obtain a plurality of final weights, and performs normalization on the input data using the plurality of final weights; and a memory that stores the plurality of final weights.
 11. The batch normalization layer quantization device of claim 10, wherein the processor assigns a first bit width, which is a part of all bit widths assigned to the quantization, to the first quantization.
 12. The batch normalization layer quantization device of claim 11, wherein the processor assigns a second bit width, which is a part of all bit widths assigned to the quantization, to the second quantization.
 13. The batch normalization layer quantization device of claim 12, wherein the first bit width and the second bit width are the same.
 14. The batch normalization layer quantization device of claim 13, wherein the first bit width and the second bit width are 4 bits.
 15. The batch normalization layer quantization device of claim 10, wherein the first quantization is an integer power-of-two quantization, and the second quantization is a dynamic range floating point quantization.
 16. The batch normalization layer quantization device of claim 10, wherein the first distribution information includes an average value and a variance value of the plurality of first weights, and the second distribution information includes an average value and a variance value of the plurality of second weights.
 17. The batch normalization layer quantization device of claim 10, wherein the processor repeats the receiving, the obtaining of the distribution information, and the quantizing, for the plurality of first weights a predetermined number of times.
 18. A quantization method for weights of a plurality of batch normalization layers, comprising: receiving a plurality of previously learned first weights of the plurality of batch normalization layers; obtaining first distribution information of the plurality of first weights; performing a first quantization on the plurality of first weights using the first distribution information to obtain a plurality of second weights; obtaining second distribution information of the plurality of second weights; performing a second quantization on the plurality of second weights using the second distribution information to obtain a plurality of final weights; and performing normalization on the input data using the plurality of final weights.
 19. The quantization method of claim 18, wherein the first distribution information includes an average value and a variance value of the plurality of first weights, and the second distribution information includes an average value and a variance value of the plurality of second weights.
 20. The quantization method of claim 19, further comprising repeatedly applying a quantization process for the first layer of the remaining layers among the plurality of batch normalization layers. 